home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / uwserver.zip / uwserver.tar / lib / uw_gtitle.c < prev    next >
C/C++ Source or Header  |  1991-01-25  |  1KB  |  52 lines

  1. /*
  2.  *    uw library - uw_gtitle, uw_stitle
  3.  *
  4.  * Copyright 1986 by John D. Bruner.  All rights reserved.  Permission to
  5.  * copy this program is given provided that the copy is not sold and that
  6.  * this copyright notice is included.
  7.  */
  8. #include <strings.h>
  9. #include "uwlib.h"
  10.  
  11. uw_gtitle(uwin, ttl)
  12. register UWIN uwin;
  13. uwtitle_t ttl;
  14. {
  15.     /*
  16.      * Get the title of window "uwin" and put it in "ttl".
  17.      */
  18.     if (uwin != (UWIN)0) {
  19.         (void)strncpy(ttl, uwin->uwi_title, sizeof(uwtitle_t));
  20.         if (uwin->uwi_ctlfd > 0) {
  21.             return(0);
  22.         } else {
  23.             uwerrno = uwin->uwi_uwerr = UWE_NOCTL;
  24.             return(-1);
  25.         }
  26.     } else {
  27.         uwerrno = UWE_INVAL;
  28.         return(-1);
  29.     }
  30. }
  31.  
  32. uw_stitle(uwin, ttl)
  33. register UWIN uwin;
  34. uwtitle_t ttl;
  35. {
  36.     union uwoptval optval;
  37.  
  38.     /*
  39.      * Set the title of window "uwin" to "ttl".
  40.      */
  41.     if (uwin != (UWIN)0) {
  42.         (void)strncpy(uwin->uwi_title, ttl, sizeof uwin->uwi_title);
  43.         uwin->uwi_title[sizeof uwin->uwi_title - 1] = '\0';
  44.         (void)strncpy(optval.uwov_string,ttl,sizeof optval.uwov_string);
  45.         optval.uwov_string[sizeof optval.uwov_string - 1] = '\0';
  46.         return(uw_optcmd(uwin, UWOP_TITLE, UWOC_SET, &optval));
  47.     } else {
  48.         uwerrno = UWE_INVAL;
  49.         return(-1);
  50.     }
  51. }
  52.